<?php
if ($this->session->userdata('logged_in') == TRUE) {
    $this->load->view('view_login_success');
}
?>
<?php $this->load->view('view_pageheader'); ?>
<label class="content_linkBack"><a onClick='window.history.go(-1)'>< Back</a></label>
<label class="content_this">| MENU MANAGER </label>

<style type="text/css">
    table.register {
        margin: auto;
        margin-top: 5px;
        border: #010101 solid 1px;
        border-left-style: none;
        border-right-style: none;
        text-align: center;
        padding: 5px 5px;

    }
    table.register th {
        color: #000;
        border: #ecebeb solid 1px;
    }
    table.register td {
        border: #ecebeb solid 1px;
    }
    table.register tr:hover {
        background-color: #ffcc99;
    }
    table.register tr td > a {
        cursor: pointer;
    }
</style>
<script type="text/javascript">
    function select_menu() {
        select_menu_all.submit();
    }
    function selectmenu(){
        document.formlist.submit();
    }
</script>
<div style="border: red hidden 1px; width: 100%;">
    <table border="0" cellpadding="5" class="register">
        <tr style="text-align: right; background: #fff;">
            <td colspan="4" >
                <form id= "formlist" name="formlist" method="post" action="show_menu">
                    Group Menu
                    <select name="select" onchange="selectmenu();">
                        <?php
                        echo "<option>-select group menu-</option>";
                        echo "<option>-all menu-</option>";
                        foreach ($gmenu as $nameg) {
                            echo "<option>" . $nameg->gmenu_name . "</option>";
                        }
                        ?>
                    </select>
                </form></td>
            <td colspan="4">
                <form action="Menu" id="" name="select_menu_all" method="post">
                    <div style="margin-top: 17px;">
                        <label>เลือกรูปแบบการแสดง : </label>
                        <select id="" name="select_menu_all_id" onchange="select_menu();">
                            <option value="-1">Choose...</option>
                            <option value="0">Non-Active</option>
                            <option value="1">Active</option>
                            <option value="2">Default</option>
                        </select>
                    </div>
                </form>
            </td>
            <td>
                <div align="center">
                    <a href="New_menu"><img style="width: 20px; height: 20px;"  src="../../images/new.png" /></a>
                </div>
            </td>
        </tr>
        <tr style="background-color: #fff">
            <th>ID</th>
            <th colspan="2" style="width: 150px">MENUNAME</th>
            <th colspan="3" style="width: 300px">LINK</th>
            <th>ACTIVE</th>
            <th>EDIT</th>
            <th>DELETE</th>
        </tr>
        <?php foreach ($menumanag as $testing) { ?>
            <tr>
                <td><?php echo $testing->menu_id . "<br />"; ?></td>
                <td colspan="2" style="width: 150px" ><?php echo $testing->menu_name . "<br />"; ?></td>
                <td colspan="3" style="width: 300px" ><?php echo $testing->menu_link . "<br />"; ?></td>
            <form action="Menu" id="activemenu" name="activemenu" method="post">
                <td><div align="center" >
                        <? if (($testing->active) != 1) { ?>
                            <input type="image" <? echo img('images/check_false.png'); ?>
                                   <input type="hidden" name="activemenu" value="<? echo $testing->active . $testing->menu_id; ?>"  />
                               <? } else { ?>
                            <input type="image" <? echo img('images/check_true.png');
                       } ?> 
                               <input type="hidden" name="activemenu" value="<? echo $testing->active . $testing->menu_id; ?>" />      
                    </div></td>
            </form>
            
            <form action="edit_menu" name="formmenu3" method="post">
                <td><div align="center" >
                        <input type="image" <? echo img('images/4.png'); ?> 
                               <input type="hidden" name="editmenu" value="<? echo $testing->menu_id; ?>" />         
                    </div></td>
            </form>
            <form action="Menu" name="deletemenu" method="post">
                <td><div align="center" >
                        <input type="image" <? echo img('images/5.png'); ?> 
                               <input type="hidden" name="deletemenu" value="<? echo $testing->menu_id; ?>" />
                    </div></td>
            </form>
<? } ?>                     
        </tr>
    </table>
</div>
<?php $this->load->view('view_pagefooter'); ?>
